﻿CREATE TABLE [dbo].[DefinedAttributeLookupRules] (
    [AttributeLookupName] NVARCHAR (255) NOT NULL,
    [AttributeLookupRule] NVARCHAR (255) NOT NULL,
    [LookupEntityType]    NVARCHAR (200) NULL,
    [LookupEntitySubType] NVARCHAR (100) NULL,
    CONSTRAINT [PK_DefinedAttributeLookupRules] PRIMARY KEY CLUSTERED ([AttributeLookupName] ASC)
);


GO
CREATE NONCLUSTERED INDEX [IX_DefinedAttributeValueRules]
    ON [dbo].[DefinedAttributeLookupRules]([AttributeLookupName] ASC);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'DefinedAttributeLookupRules';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'This will either have RegExp type rules OR it is one of four Lookup Types: Lookup = data comes from LookupValues table; EntityLookup = data comes from Entity Table; PeriodLookup = data comes from DefinedDayPeriods; TimeLookup = data comes from TimeDivisions', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'DefinedAttributeLookupRules', @level2type = N'COLUMN', @level2name = N'AttributeLookupRule';

